From 8602ae81362863d777b91e24a44f39cd7f02ab3c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Sun, 11 Sep 2005 19:27:19 +0000 Subject: [PATCH] NULL sentinel attribute --- ChangeLog | 8 ++++++++ babl/babl-format.c | 4 ++++ babl/babl-model.c | 4 ++++ babl/babl.h | 9 +++++++-- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 25ae69e..10e5853 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-09-11 Øyvind Kolås + + * babl/babl.h: use gcc 4.x attribute for NULL sentinel. + * babl/babl-format.c: (babl_format_new): added missing enumeration + values to switch. + * babl/babl-model.c: (babl_model_new): added missing enumeration + values to switch. + 2005-09-11 Øyvind Kolås * tests/formats.c: new test (that might form the basis of loss diff --git a/babl/babl-format.c b/babl/babl-format.c index 45ffcf0..f461639 100644 --- a/babl/babl-format.c +++ b/babl/babl-format.c @@ -199,6 +199,8 @@ babl_format_new (void *first_arg, switch (babl->class_type) { case BABL_TYPE: + case BABL_TYPE_FLOAT: + case BABL_TYPE_INTEGER: current_type = (BablType*) babl; break; case BABL_COMPONENT: @@ -236,8 +238,10 @@ babl_format_new (void *first_arg, case BABL_CONVERSION_PLANE: case BABL_CONVERSION_PLANAR: case BABL_FISH: + case BABL_FISH_SIMPLE: case BABL_FISH_REFERENCE: case BABL_IMAGE: + case BABL_EXTENSION: babl_log ("%s unexpected", babl_class_name (babl->class_type)); break; diff --git a/babl/babl-model.c b/babl/babl-model.c index d3fa478..f48779e 100644 --- a/babl/babl-model.c +++ b/babl/babl-model.c @@ -113,6 +113,8 @@ babl_model_new (void *first_argument, babl_log ("submodels not handled yet"); break; case BABL_TYPE: + case BABL_TYPE_INTEGER: + case BABL_TYPE_FLOAT: case BABL_SAMPLING: case BABL_INSTANCE: case BABL_FORMAT: @@ -124,7 +126,9 @@ babl_model_new (void *first_argument, case BABL_CONVERSION_PLANAR: case BABL_FISH: case BABL_FISH_REFERENCE: + case BABL_FISH_SIMPLE: case BABL_IMAGE: + case BABL_EXTENSION: babl_log ("%s unexpected", babl_class_name (babl->class_type)); break; case BABL_SKY: /* shut up compiler */ diff --git a/babl/babl.h b/babl/babl.h index b178456..6b6085f 100644 --- a/babl/babl.h +++ b/babl/babl.h @@ -41,6 +41,11 @@ void babl_init (void); */ void babl_destroy (void); +#if __GNUC__ >= 4 +#define BABL_ARG_NULL_TERMINATED __attribute__((__sentinel__)) +#else +#define BABL_ARG_NULL_TERMINATED +#endif #define BABL_CLASS_NO_NAME(type_name) \ \ @@ -55,7 +60,7 @@ void babl_##type_name##_each (BablEachFunction each_fun, \ BABL_CLASS_NO_NAME (type_name) \ Babl * babl_##type_name (const char *name); \ Babl * babl_##type_name##_new (void *first_arg, \ - ...); + ...) BABL_ARG_NULL_TERMINATED; typedef int (*BablEachFunction) (Babl *entry, void *data); @@ -99,7 +104,7 @@ long babl_process (Babl *babl_fish, * NULL); */ Babl * babl_image (void *first_component, - ...); + ...) BABL_ARG_NULL_TERMINATED; -- 2.30.2